package com.zach.common.dao.sqlmapimpl;

import java.util.List;

import org.mybatis.spring.support.SqlSessionDaoSupport;

import com.zach.common.dao.UserFunctionTreeDao;
import com.zach.common.entity.UserFunctionTree;
@SuppressWarnings("unchecked")
public class UserFunctionTreeDaoImpl extends SqlSessionDaoSupport implements
		UserFunctionTreeDao {
	private static final long serialVersionUID = 5417787840573223018L;

	@Override
	public void addNode(UserFunctionTree tree) {
		getSqlSession().insert("addNode", tree);
	}
	
	@Override
	public void delNode(String nodeId) {
		getSqlSession().delete("delNode", nodeId);
	}

	@Override
	public void updateNode(UserFunctionTree tree) {
		getSqlSession().update("updateNode", tree);
	}

	@Override
	public void updateNodeExt(UserFunctionTree tree) {
		getSqlSession().update("updateNodeExt", tree);
	}

	@Override
	public UserFunctionTree getNode(String nodeId) {
		return (UserFunctionTree) getSqlSession().selectOne("getNode", nodeId);
	}

	@Override
	public List<UserFunctionTree> getTreeList(UserFunctionTree tree) {
		return (List<UserFunctionTree>)getSqlSession().selectList("getTreeList", tree);
	}

	@Override
	public List<UserFunctionTree> getTreeListByUserId(String loginName) {
		return (List<UserFunctionTree>)getSqlSession().selectList("getTreeListByUserId", loginName);
	}

	@Override
	public List<UserFunctionTree> getTreeListByRole(String roleId) {
		return (List<UserFunctionTree>)getSqlSession().selectList("getTreeListByRole", roleId);
	}

	@Override
	public List<UserFunctionTree> getTreeListByParentId(String parentId) {
		return (List<UserFunctionTree>)getSqlSession().selectList("getTreeListByParentId", parentId);
	}

	@Override
	public List<UserFunctionTree> getTreeListByParentIdAndOther(
			UserFunctionTree tree) {
		return (List<UserFunctionTree>)getSqlSession().selectList("getTreeListByParentIdAndOther", tree);
	}
	
}
